package indi.zhifa.study2024.class001.busy.generalTest.controller.helloworld;

import indi.zhifa.study2024.class001.busy.generalTest.business.helloworld.entity.response.ServerInfo;
import indi.zhifa.study2024.class001.busy.generalTest.business.helloworld.entity.response.SiteInfo;
import indi.zhifa.study2024.class001.busy.generalTest.business.helloworld.service.IHelloWorldService;
import indi.zhifa.study2024.class001.busy.generalTest.enums.common.EWeekDay;
import indi.zhifa.study2024.class001.busy.generalTest.enums.person.EGender;
import indi.zhifa.study2024.core.common.web.entity.ann.ZhiFaRestController;
import indi.zhifa.study2024.core.common.web.entity.response.RestResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Slf4j
@Validated
@RequiredArgsConstructor
@RequestMapping(value = "/class001/hello")
@ZhiFaRestController
@Tag(name = "hello world")
public class HelloWorldController {

    private final IHelloWorldService mHelloWorldService;

    @Operation(summary = "hello world")
    @GetMapping("/hello_world")
    public String helloWorld(){
        return mHelloWorldService.helloWorld();
    }

    @Operation(summary = "siteInfo")
    @GetMapping("/siteInfo")
    public SiteInfo siteInfo(){
        return mHelloWorldService.siteInfo();
    }

    @Operation(summary = "serverInfo")
    @GetMapping("/serverInfo")
    public ServerInfo serverInfo(){
        return mHelloWorldService.serverInfo();
    }

    @Operation(summary = "hello gender")
    @GetMapping("/hello/gender/{gender}")
    RestResponse<String> helloGender(@PathVariable(name = "gender") EGender pGender)
    {
        String result = mHelloWorldService.helloGender(pGender);
        return RestResponse.ok(result);
    }

    @Operation(summary = "hello weekday")
    @GetMapping("/hello/weekday/{weekday}")
    RestResponse<String> helloWeekday(@PathVariable(name = "weekday") EWeekDay pWeekDay)
    {
        String result = mHelloWorldService.helloWeekday(pWeekDay);
        return RestResponse.ok(result);
    }


}
